package cn.admin.configcenter.registry.service;

import java.util.concurrent.atomic.AtomicLong;

public class RecordCounterHolder {

    private static RecordCounterHolder holder = new RecordCounterHolder();
    private final AtomicLong pushCount = new AtomicLong(0L);
    private final AtomicLong pushFailedCount = new AtomicLong(0L);
    private final AtomicLong syncFailedCount = new AtomicLong(0L);
    private final AtomicLong syncCount = new AtomicLong(0L);
    private final AtomicLong processRequestCount = new AtomicLong(0L);
    private final AtomicLong pushEmptyCount = new AtomicLong(0L);
    private final AtomicLong tpOrNotifyTaskCount = new AtomicLong(0L);
    private final AtomicLong defaultTaskCount = new AtomicLong(0L);

    public static RecordCounterHolder getHolder() {
        return holder;
    }

    public void increasePushCount() {
        this.pushCount.incrementAndGet();
    }

    public void increaseSyncCount() {
        this.syncCount.incrementAndGet();
    }

    public void increaseProcessRequestCount() {
        this.processRequestCount.incrementAndGet();
    }

    public void increasePushFailedCount() {
        this.pushFailedCount.incrementAndGet();
    }

    public void increaseSyncFailedCount() {
        this.syncFailedCount.incrementAndGet();
    }

    public void increasePushEmptyCount() {
        this.pushEmptyCount.incrementAndGet();
    }

    public long getPushCount() {
        return this.pushCount.longValue();
    }

    public long getSyncCount() {
        return this.syncCount.longValue();
    }

    public long getPushFailedCount() {
        return this.pushFailedCount.longValue();
    }

    public long getSyncFailedCount() {
        return this.syncFailedCount.longValue();
    }

    public long getPushEmptyCount() {
        return this.pushEmptyCount.longValue();
    }

    public long getProcessRequestCount() {
        return this.processRequestCount.longValue();
    }

    public void increaseTpOrNotifyTaskCount() {
        this.tpOrNotifyTaskCount.incrementAndGet();
    }

    public void increaseDefaultTaskCount() {
        this.defaultTaskCount.incrementAndGet();
    }

    public AtomicLong getTpTaskCount() {
        return this.tpOrNotifyTaskCount;
    }

    public AtomicLong getDefaultTaskCount() {
        return this.defaultTaskCount;
    }
}
